//
//  ShipFSM.h
//  SpaceStorm
//
//  Created by 祥 雍 on 13-7-26.
//  Copyright (c) 2013年 __MyCompanyName__. All rights reserved.
//
//
//  舰船的状态机：搜索敌人，锁敌状态，接近状态，战斗状态，撤离状态，特攻状态

#import "FSMBase.h"
#import "cocos2d.h"

@class Ship;
@class ShipFSMManager;

/**
    船舰搜索敌人的状态机
 */
@interface ShipSearch : FSMBase
{
    ShipFSMManager* _manager;
}

+(id) searchStateWithManager:(ShipFSMManager*)manager;
-(id) initStateWithManager:(ShipFSMManager*)manager;

@property (readwrite, retain) ShipFSMManager* manager; 

@end

/**
	船舰锁定目标的状态机
 */
@interface ShipLockTarget : FSMBase 
{
     ShipFSMManager* _manager;
}

+(id) lockTargetStateWithManager:(ShipFSMManager*)manager;
-(id) initStateWithManager:(ShipFSMManager*)manager;

@property (readwrite, retain) ShipFSMManager* manager; 

@end

/**
	船舰接近目标的状态机
 */
@interface ShipCloseTo : FSMBase 
{
    ShipFSMManager* _manager;
}

+(id) closeToStateWithManager:(ShipFSMManager*)manager;
-(id) initStateWithManager:(ShipFSMManager*)manager;

@property (readwrite, retain) ShipFSMManager* manager; 

@end

/**
	船舰特攻的状态机
 */
@interface ShipSpecialAttack : FSMBase 
{
    ShipFSMManager* _manager;
}

+(id) specialAttackStateWithManager:(ShipFSMManager*)manager;
-(id) initStateWithManager:(ShipFSMManager*)manager;

@property (readwrite, retain) ShipFSMManager* manager; 

@end

/**
	船舰开火的状态机
 */
@interface ShipFire : FSMBase 
{
    ShipFSMManager* _manager;
}

+(id) fireStateWithManager:(ShipFSMManager*)manager;
-(id) initStateWithManager:(ShipFSMManager*)manager;

@property (readwrite, retain) ShipFSMManager* manager; 

@end

/**
	船舰撤离的状态机
 */
@interface ShipEvacuate : FSMBase 
{
    ShipFSMManager* _manager;
}

+(id) evacuateStateWithManager:(ShipFSMManager*)manager;
-(id) initStateWithManager:(ShipFSMManager*)manager;

@property (readwrite, retain) ShipFSMManager* manager; 
@end

/**
	舰船状态机的管理类 */
@interface ShipFSMManager : FSMManagerBase
{
    Ship*               _ship;
    ShipSearch*         _searchState;
    ShipLockTarget*     _lockTargetState;
    ShipCloseTo*        _closeToState;
    ShipSpecialAttack*  _specialAttackState;
    ShipFire*           _fireState;
    ShipEvacuate*       _evacuateState;
}

+(id) managerWithShip:(Ship*)ship;
-(id) initWithShip:(Ship*)ship;

-(void) toSearch;
-(void) toLockTarget;
-(void) toCloseTo;
-(void) toSpecialAttack;
-(void) toFire;
-(void) toEvacuate;


@property (readwrite, retain) Ship* ship; 
@property (readwrite, retain) ShipSearch* searchState; 
@property (readwrite, retain) ShipLockTarget* lockTargetState; 
@property (readwrite, retain) ShipCloseTo* closeToState; 
@property (readwrite, retain) ShipSpecialAttack* specialAttackState; 
@property (readwrite, retain) ShipFire* fireState; 
@property (readwrite, retain) ShipEvacuate* evacuateState; 

@end


